/**
 * FileName: AirCarRecordService
 * Author:   Leopold
 * Date:     2018/10/11 20:13
 * Description:
 * History:
 */
package cn.mcsys.myadmin.modules.air.service;

import cn.mcsys.myadmin.modules.air.dao.AirCarRecordDao;
import cn.mcsys.myadmin.modules.air.entity.AirCarRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AirCarRecordService {

    @Autowired
    private AirCarRecordDao airCarRecordDao;

    public Integer arriveSum(String pointName,String date){
        Integer sum = 0;
        if("all".equals(date)){
            sum += airCarRecordDao.selectPointArriveSum(pointName, "2018-11-09");
            sum += airCarRecordDao.selectPointArriveSum(pointName, "2018-11-10");
            sum += airCarRecordDao.selectPointArriveSum(pointName, "2018-11-11");
        }else {
            sum = airCarRecordDao.selectPointArriveSum(pointName, date);
        }
        return sum;
    }

    public List<AirCarRecord> getRecordsByPointIdAndDate(Integer id, Date date) {
        return airCarRecordDao.getRecordsByPointIdAndDate(id,date);
    }

    public List<AirCarRecord> getCarRecord(Long carid, Date beginDate, Date endDate) {
        return airCarRecordDao.getCarRecord(carid,beginDate,endDate);
    }
}
